<html>
<head>
	<title>Tests for JU.validate</title>
	
	<script type="text/javascript" src="jsunit/app/jsUnitCore.js"></script>
	<script type="text/javascript" src="../src/janutils.js"></script>
	
	<script type="text/javascript">
	
	//--------------------------------------------------------------------------
	// Tests with null parameters
	//--------------------------------------------------------------------------
	
	/*
	 * Tests empty() with a null parameter
	 */
	function testEmptyWithNull() {
		assertTrue(JU.validate.empty(null));
	}
	
	/*
	 * Tests blank() with a null parameter
	 */
	function testBlankWithNull() {
		assertTrue(JU.validate.blank(null));
	}
	
	/*
	 * Tests digits() with a null parameter
	 */
	function testDigitsWithNull() {
		assertFalse(JU.validate.digits(null));
	}
	
	/*
	 * Tests integer() with a null parameter
	 */
	function testIntegerWithNull() {
		assertFalse(JU.validate.integer(null));
	}
	
	/*
	 * Tests decimal() with a null parameter
	 */
	function testDecimalWithNull() {
		assertFalse(JU.validate.decimal(null));
	}
	
	//--------------------------------------------------------------------------
	// Tests with undefined parameters
	//--------------------------------------------------------------------------
	
	/*
	 * Tests empty() with a undefined parameter
	 */
	function testEmptyWithUndefined() {
		assertTrue(JU.validate.empty(undefined));
	}
	
	/*
	 * Tests blank() with a undefined parameter
	 */
	function testBlankWithUndefined() {
		assertTrue(JU.validate.blank(undefined));
	}
	
	/*
	 * Tests digits() with a undefined parameter
	 */
	function testDigitsWithUndefined() {
		assertFalse(JU.validate.digits(undefined));
	}
	
	/*
	 * Tests integer() with a undefined parameter
	 */
	function testIntegerWithUndefined() {
		assertFalse(JU.validate.integer(undefined));
	}
	
	/*
	 * Tests decimal() with a undefined parameter
	 */
	function testDecimalWithUndefined() {
		assertFalse(JU.validate.decimal(undefined));
	}
	
	//--------------------------------------------------------------------------
	// Tests with empty parameters
	//--------------------------------------------------------------------------
	
	/*
	 * Tests empty() with an empty string parameter
	 */
	function testEmptyWithEmptyString() {
		assertTrue(JU.validate.empty(''));
	}
	
	/*
	 * Tests blank() with an empty string parameter
	 */
	function testBlankWithEmptyString() {
		assertTrue(JU.validate.blank(''));
	}
	
	/*
	 * Tests digits() with an empty string parameter
	 */
	function testDigitsWithEmptyString() {
		assertFalse(JU.validate.digits(''));
	}
	
	/*
	 * Tests integer() with an empty string parameter
	 */
	function testIntegerWithEmptyString() {
		assertFalse(JU.validate.integer(''));
	}
	
	/*
	 * Tests decimal() with an empty string parameter
	 */
	function testDecimalWithEmptyString() {
		assertFalse(JU.validate.decimal(''));
	}
	
	//--------------------------------------------------------------------------
	// Tests with correct parameters
	//--------------------------------------------------------------------------
	
	/*
	 * Tests empty() with an expected input
	 */
	function testEmpty() {
		assertTrue(JU.validate.empty(''));
	}
	
	/*
	 * Tests blank() with an expected input
	 */
	function testBlank() {
		assertTrue(JU.validate.blank('      '));
	}
	
	/*
	 * Tests digits() with an expected input
	 */
	function testDigits() {
		assertTrue(JU.validate.digits('0123456789'));
	}
	
	/*
	 * Tests integer() with an positive integer
	 */
	function testIntegerPositive() {
		assertTrue(JU.validate.integer('123456789'));
	}
	
	/*
	 * Tests integer() with a negative integer
	 */
	function testIntegerNegative() {
		assertTrue(JU.validate.integer('-123456789'));
	}
	
	/*
	 * Tests integer() with an positive integer starting with zero
	 */
	function testIntegerPositiveStartingWithZero() {
		assertTrue(JU.validate.integer('0123456789'));
	}
	
	/*
	 * Tests integer() with a negative integer starting with zero
	 */
	function testIntegerNegativeStartingWithZero() {
		assertTrue(JU.validate.integer('-0123456789'));
	}
	
	/*
	 * Tests integer() with a zero
	 */
	function testIntegerZero() {
		assertTrue(JU.validate.integer('0'));
	}
	
	/*
	 * Tests integer() with zeroes
	 */
	function testIntegerZeroes() {
		assertTrue(JU.validate.integer('000000000'));
	}
	
	/*
	 * Tests integer() with a minus zero
	 */
	function testIntegerWithMinusZero() {
		assertTrue(JU.validate.integer('-0'));
	}
	
	/*
	 * Tests integer() with a minus zero
	 */
	function testIntegerWithMinusZeroes() {
		assertTrue(JU.validate.integer('-00000000'));
	}
	
	/*
	 * Tests decimal() with a positive number
	 */
	function testDecimalPositive() {
		assertTrue(JU.validate.decimal('1234.56789'));
	}
	
	/*
	 * Tests decimal() with a negative number
	 */
	function testDecimalNegative() {
		assertTrue(JU.validate.decimal('-1234.56789'));
	}
	
	/*
	 * Tests decimal() with a positive integer starting with zero
	 */
	function testDecimalPositiveStartingWithZero() {
		assertTrue(JU.validate.decimal('01234.56789'));
	}
	
	/*
	 * Tests decimal() with a negative integer starting with zero
	 */
	function testDecimalNegativeStartingWithZero() {
		assertTrue(JU.validate.decimal('-01234.56789'));
	}
	
	/*
	 * Tests decimal() with a positive integer
	 */
	function testDecimalWithPositiveInteger() {
		assertTrue(JU.validate.decimal('123456789'));
	}
	
	/*
	 * Tests decimal() with a negative integer
	 */
	function testDecimalWithNegativeInteger() {
		assertTrue(JU.validate.decimal('-123456789'));
	}
	
	/*
	 * Tests decimal() with a positive integer starting with zero
	 */
	function testDecimalWithPositiveIntegerStartingWithZero() {
		assertTrue(JU.validate.decimal('0123456789'));
	}
	
	/*
	 * Tests decimal() with a negative integer starting with zero
	 */
	function testDecimalWithNegativeIntegerStartingWithZero() {
		assertTrue(JU.validate.decimal('-0123456789'));
	}
	
	/*
	 * Tests decimal() with a zero
	 */
	function testDecimalZero() {
		assertTrue(JU.validate.decimal('0'));
	}
	
	/*
	 * Tests decimal() with zeroes
	 */
	function testDecimalZeroes() {
		assertTrue(JU.validate.decimal('000000000'));
	}
	
	/*
	 * Tests decimal() with a minus zero
	 */
	function testDecimalWithMinusZero() {
		assertTrue(JU.validate.decimal('-0'));
	}
	
	/*
	 * Tests decimal() with a minus zero
	 */
	function testDecimalWithMinusZeroes() {
		assertTrue(JU.validate.decimal('-00000000'));
	}
	
	/*
	 * Tests decimal() with a minus zero point zero
	 */
	function testDecimalWithMinusZeroPointZero() {
		assertTrue(JU.validate.decimal('-0.0'));
	}
	
	/*
	 * Tests decimal() with a minus zeroes point zero
	 */
	function testDecimalWithMinusZeroes() {
		assertTrue(JU.validate.decimal('-00000000.0'));
	}

	//--------------------------------------------------------------------------
	// Tests with incorrect parameters
	//--------------------------------------------------------------------------
	
	/*
	 * Tests empty() with an space
	 */
	function testEmptyWithSpace() {
		assertFalse(JU.validate.empty(' '));
	}
	
	/*
	 * Tests empty() with an alphabetic parameter
	 */
	function testEmptyWithAlpha() {
		assertFalse(JU.validate.empty('JanUtils'));
	}
	
	/*
	 * Tests blank() with an alphabetic parameter
	 */
	function testBlankWithAlpha() {
		assertFalse(JU.validate.blank('JanUtils'));
	}
	
	/*
	 * Tests blank() with an string that starts with a space
	 */
	function testBlankWithStartSpace() {
		assertFalse(JU.validate.blank(' a'));
	}
	
	/*
	 * Tests blank() with an string that finishes with a space
	 */
	function testBlankWithFinishSpace() {
		assertFalse(JU.validate.blank('a '));
	}
	
	/*
	 * Tests integer() with an alphabetic parameter
	 */
	function testIntegerWithAlpha() {
		assertFalse(JU.validate.integer('JanUtils'));
	}
	
	/*
	 * Tests integer() with a minus sign
	 */
	function testIntegerWithMinus() {
		assertFalse(JU.validate.integer('-'));
	}
	
	/*
	 * Tests integer() with a double minus sign
	 */
	function testIntegerWithDoubleMinus() {
		assertFalse(JU.validate.integer('--'));
	}
	
	/*
	 * Tests decimal() with an alphabetic parameter
	 */
	function testDecimalWithAlpha() {
		assertFalse(JU.validate.decimal('JanUtils'));
	}
	
	/*
	 * Tests decimal() with a minus sign
	 */
	function testDecimalWithMinus() {
		assertFalse(JU.validate.decimal('-'));
	}
	
	/*
	 * Tests decimal() with a double minus sign
	 */
	function testDecimalWithDoubleMinus() {
		assertFalse(JU.validate.decimal('--'));
	}
	
	/*
	 * Tests digits() with an alphabetic parameter
	 */
	function testDigitsWithAlpha() {
		assertFalse(JU.validate.digits('JanUtils'));
	}
	
	/*
	 * Tests digits() with an string that starts with a space
	 */
	function testDigitsWithStartSpace() {
		assertFalse(JU.validate.digits(' 9'));
	}
	
	/*
	 * Tests digits() with an string that finishes with a space
	 */
	function testDigitsWithFinishSpace() {
		assertFalse(JU.validate.digits('9 '));
	}
	
	/*
	 * Tests digits() with an string that starts with a space
	 */
	function testDigitsWithStartSpace() {
		assertFalse(JU.validate.digits(' 9'));
	}
	
	/*
	 * Tests digits() with an string that finishes with a space
	 */
	function testDigitsWithFinishSpace() {
		assertFalse(JU.validate.digits('9 '));
	}
	
	</script>
</head>
<body>
</body>
</html>